<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 
    <div id="comments">
    	<ul>
	    <c:forEach items="${requestScope.pageInfo.list }" var="comment">
	    	<li id="firComment">
	        <div class="us">
		        <img src="<%=path %>/static/head_img/${comment.userinfo.headName}" alt="评论者">
		        <span>${comment.userinfo.nickName }</span> <span>日期&nbsp;<fmt:formatDate value="${comment.inputTime }" pattern="yyyy-MM-dd"/></span>
		        <span id="reply">回复</span><span id="cancelReply">取消回复</span>
	        </div>
	        <p>${comment.content }</p>
	        <c:if test="${not empty comment.childComments }">
	        	<div id="child" style="display:none;">
		        <ul id="">
		        <c:forEach begin="0" end="${fn:length(comment.childComments)}" varStatus="stat"  items="${comment.childComments }">
		          <li>
		            <div class="us"><img src="<%=path %>/static/head_img/${comment.childComments[fn:length(comment.childComments)-stat.count].userinfo.headName}" alt="评论者"><span>${comment.childComments[fn:length(comment.childComments)-stat.count].userinfo.nickName }</span> <span>日期&nbsp;<fmt:formatDate value="${comment.childComments[fn:length(comment.childComments)-stat.count].inputTime }" pattern="yyyy-MM-dd"/></span></div>
		            <p>${comment.childComments[fn:length(comment.childComments)-stat.count].content }</p>
		           </li>
		         </c:forEach>	
		         </ul>
		         </div>
		         <p  id="more">共${fn:length(comment.childComments)}条回复>>></p><p style="display:none" id="close">收起<<</p>
	          </c:if>
	          
	          <div style="display:none;" id="replyDiv">
          		<form>
			     <textarea id="content2" placeholder="写下您的回复..."></textarea>
			     <input type="hidden" id="articleId" value="${requestScope.article.id }"/>
			      <input type="hidden" id="parentId" value="${comment.id }"/>
			     <input type="button" class="seach_bun" id="sub2" value="确认回复">
			   </form>
	          </div>
	          
	        </li>
	    </c:forEach>
    	</ul>
    
<!-- 分页开始 -->
  <div class="pagination">
    <a id="first" href="javaScript:void(0)">首页</a>
    <c:forEach items="${requestScope.pageInfo.navigatepageNums }" var="page">
    	<a id="page${page }" href="javaScript:void(0)" class="number">${page}</a>
    </c:forEach>
    <a id="last" href="javaScript:void(0)">尾页</a>
    <input type="hidden" value="${requestScope.pageInfo.pages}"/>
    <span>共${requestScope.pageInfo.pages}页</span>&nbsp;&nbsp;
	<span>共&nbsp;${requestScope.pageInfo.total}&nbsp;条评论</span>
  </div>
<!-- 分页结束 -->
</div>

<script type="text/javascript">
$(function(){
	
	$("#page${requestScope.pageInfo.pageNum}").css("background-color","#666");
	$("#page${requestScope.pageInfo.pageNum}").css("color","white"); 
});


</script>





